package com.umeox.watch.moto.apiclient.http;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.reflect.TypeToken;
import com.umeox.watch.httpclient.core.constant.HttpMethod;
import com.umeox.watch.moto.apiclient.model.AlarmDTO;
import com.umeox.watch.moto.apiclient.model.BuddyDTO;
import com.umeox.watch.moto.apiclient.model.ConcernTimeDTO;
import com.umeox.watch.moto.apiclient.model.ContactDTO;
import com.umeox.watch.moto.apiclient.model.DeviceConfigDTO;
import com.umeox.watch.moto.apiclient.model.ForbidPeriodDTO;
import com.umeox.watch.moto.apiclient.model.MessageDTO;
import com.umeox.watch.moto.apiclient.model.MultipleForbidPeriodDTO;
import com.umeox.watch.moto.apiclient.model.ServerConfigDTO;
import com.umeox.watch.moto.apiclient.model.StepDTO;
import com.umeox.watch.moto.apiclient.model.TokenDTO;
import com.umeox.watch.moto.apiclient.model.WallpaperDTO;
import com.umeox.watch.moto.apiclient.model.WifiDTO;

import java.util.List;

/**
 * API类型定义
 * 使用枚举重新定义
 */
public enum ApiEnum {
    /***/
    ACCESS_TOKEN(HttpMethod.POST_JSON, BaseApi.DEFINE_API, "oauth2/accessToken", new TypeToken<TokenDTO>() {
    }),
    UPLOAD_FILE(HttpMethod.POST_FILE, BaseApi.FILE_API, "", new TypeToken<JSONObject>() {
    }),
    INIT_SERVER_CONFIG(HttpMethod.GET, BaseApi.DEFINE_API, "server/config/get", new TypeToken<ServerConfigDTO>() {
    }),
    INIT_DEVICE_CONFIG(HttpMethod.GET, BaseApi.NORMAL_API, "device/config/get", new TypeToken<DeviceConfigDTO>() {
    }),
    UPLOAD_STEP(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/step/upload", new TypeToken<JSONObject>() {
    }),
    UPLOAD_LOCATION(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/location/upload", new TypeToken<JSONObject>() {
    }),
    GET_CONTACTS(HttpMethod.GET, BaseApi.NORMAL_API, "device/contact/list", new TypeToken<List<ContactDTO>>() {
    }),
    GET_BUDDIES(HttpMethod.GET, BaseApi.NORMAL_API, "device/friend/list", new TypeToken<List<BuddyDTO>>() {
    }),
    UPLOAD_SOS(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/sos/uploadRecord", new TypeToken<JSONObject>() {
    }),

    REFRESH_CLASSTIME(HttpMethod.GET, BaseApi.NORMAL_API, "device/getClassTime", new TypeToken<ForbidPeriodDTO>() {
    }),
    REFRESH_MULTIPLE_CLASSTIME(HttpMethod.GET, BaseApi.NORMAL_API, "device/getMultipleClassTime", new TypeToken<MultipleForbidPeriodDTO>() {
    }),
    REFRESH_CONCERNTIME(HttpMethod.GET, BaseApi.NORMAL_API, "device/getConcernTime", new TypeToken<ConcernTimeDTO>() {
    }),
    REFRESH_ALARMLIST(HttpMethod.GET, BaseApi.NORMAL_API, "device/alarm/list", new TypeToken<List<AlarmDTO>>() {
    }),
    MAKE_FRIEND(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/friend/request", new TypeToken<JSONObject>() {
    }),
    REFRESH_MESSAGE_LIST(HttpMethod.GET, BaseApi.NORMAL_API, "device/message/v1/list", new TypeToken<List<MessageDTO>>() {
    }),
    SEND_CHAT_MESSAGE(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/message/send", new TypeToken<MessageDTO>() {
    }),
    GET_PETINFO(HttpMethod.GET, BaseApi.NORMAL_API, "device/getSportInfo", new TypeToken<StepDTO>() {
    }),
    UPDATE_TIMEZONE(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/timezone/update", new TypeToken<JSONObject>() {
    }),
    ALBUM_UPLOAD(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/album/upload", new TypeToken<JSONObject>() {
    }),
    //邀请对方加入视频
    INVITE_JOIN_VIDEO(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/video/notifyJoinChannel", new TypeToken<JSONObject>() {
    }),
    //通知对方取消视频通话
    NOTIFY_CANCEL_VIDEO(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/video/cancelJoinChannel", new TypeToken<JSONObject>() {
    }),
    //上传视频通话记录
    UPLOAD_VIDEO_TIME(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/video/addRecords", new TypeToken<JSONObject>() {
    }),
    //获取app设置的壁纸列表
    GET_WALLPAPERS(HttpMethod.GET, BaseApi.NORMAL_API, "device/config/wallpapers", new TypeToken<List<WallpaperDTO>>() {
    }),
    //上传情景模式
    UPLOAD_AudioTypes(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/config/setAudioTypes", new TypeToken<JSONObject>() {
    }),
    //获取app设置的wifi列表
    GET_WIFI_LIST(HttpMethod.GET, BaseApi.NORMAL_API, "device/config/wifi", new TypeToken<List<WifiDTO>>() {
    }),
    UPLOAD_HEART_RATE(HttpMethod.POST_JSON, BaseApi.NORMAL_API, "device/heartRate/upload", new TypeToken<JSONObject>() {
    });


    //Enum定义结束
    private final HttpMethod method;
    private final int type;
    private final String path;
    private final TypeToken typeToken;

    ApiEnum(HttpMethod method, int type, String path, TypeToken typeToken) {
        this.path = path;
        this.method = method;
        this.type = type;
        this.typeToken = typeToken;
    }

    public int getType() {
        return type;
    }

    public String getPath() {
        return path;
    }

    public HttpMethod getMethod() {
        return method;
    }

    public TypeToken getTypeToken() {
        return typeToken;
    }
}


